import { createClient } from "redis";

const url = process.env.REDIS_URL;

const redisClient = createClient({
  url: url,
});

export async function redisConnect() {
  try {
    await redisClient.connect();
    console.log("Connected to Redis");
  } catch (err) {
    console.log(err);
  }
}

export async function redisClose() {
  try {
    await redisClient.quit();
    console.log("Connection to Redis closed");
  } catch (err) {
    console.log(err);
  }
}

export default redisClient;
